function! api#commentary#init() abort
    if !exists("g:loaded_commentary")
        try
            packadd vim-commentary
        catch /.*/
        endtry
    endif
    if exists("g:loaded_commentary") && g:loaded_commentary
        let g:commentary_map = get(g:, "commentary_map", { "name" : "+commentary" })
        let g:commentary_map[";"] = [ "Commentary", "commentary" ]
        let g:commentary_map.c = [ "ChangeCommentary", "change" ]
        let g:commentary_map.l = [ "CommentaryLine", "line" ]
        let g:space_keymap = get(g:, 'space_keymap', { 'name': '+space'})
        let g:space_keymap[";"] = g:commentary_map
        let g:space_keymap.t = get(g:space_keymap, 't', { 'name': '+toggle' })
        let g:space_keymap.t.c = [ ':Commentary', 'comment' ]
        nnoremap <m-;> :Commentary<cr>
        vnoremap <m-;> :Commentary<cr>
    endif
endfunction
